<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>rangeNumber</title>
</head>

<body>
    <div>打开浏览器查看结果，这个工具函数的使用场景，可以参考这个<a href="https://eveningwater.com/my-web-projects/js/63/" target="_blank"
            rel="noopener noreferrer">demo</a>的实现</div>
    <script>
        const rangeNumber = (num, in_min, in_max, out_min, out_max) =>
            ((num - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min;
        const num = 5;
        console.log(scale(num, 0, 10, -50, 50)); // 0
        console.log(scale(num, -20, 0, -100, 100)); // 150
    </script>
</body>

</html>